package com.skywolf.chem.tags.service.impl;

import com.skywolf.chem.common.sysconfig.pojo.vo.PageVO;
import com.skywolf.chem.home.entity.LoopImgVo;
import com.skywolf.chem.home.entity.TagsVo;
import com.skywolf.chem.manager.param.TagManagerParam;
import com.skywolf.chem.tags.entity.Tags;
import com.skywolf.chem.tags.mapper.TagsMapper;
import com.skywolf.chem.tags.service.ITagsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 标签表 服务实现类
 * </p>
 *
 * @author 
 * @since 2021-01-21
 */
@Service
public class TagsServiceImpl extends ServiceImpl<TagsMapper, Tags> implements ITagsService {

    @Autowired
    TagsMapper tagsMapper;

    @Override
    public PageVO<TagsVo> getTagsPage(TagManagerParam queryParam) {
        Long startNum = queryParam.getPageSize()*(queryParam.getPageNum()-1);
        Long endNum = queryParam.getPageSize();
        Integer count = tagsMapper.getTagPageCount(queryParam.getTname());
        List<TagsVo> list = tagsMapper.getTagPageList(startNum,endNum,queryParam.getTname());
        PageVO<TagsVo> pageVO = new PageVO(list,Long.valueOf(count),queryParam.getPageNum(),queryParam.getPageSize());
        return pageVO;
    }
}
